
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 2498. -- Xavier is Learning to Count -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>2498: Xavier is Learning to Count</h2><span class=green>Time Limit: </span>10 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>128 MB<br><span class=green>Submit: </span>1&nbsp;&nbsp;<span class=green>Solved: </span>1<br>[<a href='submitpage.php?id=2498'>Submit</a>][<a href='problemstatus.php?id=2498'>Status</a>][<a href='bbs.php?id=2498'>Discuss</a>]</center><h2>Description</h2><div class=content><div class="panel_content"><span style="font-size: medium">&nbsp;&nbsp;Xavier, a 9-year-old student, loves playing many kinds of puzzles. One of his favourites is the following:<br />
&nbsp;&nbsp;Xerier, his classmate, has made many cards. She writes down a single positive number on each of them. No numbers written on different cards are the same. After that she writes down an equation, whose right side is a single positive number chosen by her, and the left side is the sum of p integers:<br />
<br />
&nbsp;&nbsp;Then she asks Xavier put p cards on the corresponding Xi&rsquo;s position to make this equation correct, with an additional condition that Xi should be ordered from smaller to bigger, i.e.<br />
&nbsp;&nbsp;Every time Xavier immediately comes up with many solutions. Now he wants to know how many solutions in total are there for any n given by Xerier.<br />
</span></div>
<div class="panel_bottom"><span style="font-size: medium">&nbsp;</span></div>
<p><span style="font-size: medium"><br />
</span></p></div><h2>Input</h2><div class=content><p><span style="font-size: medium">&nbsp;&nbsp;There are multiple test cases. The number of them is given in the beginning of the input. Then a series of input block comes one by one.<br />
&nbsp;&nbsp;For each test case:<br />
&nbsp;&nbsp;The first line contains two space-separated integers m and p (1&lt;=p&lt;=5). The second line contains m distinct positive integers - the numbers written on each of the cards. None of these integers exceeds 13000.<br />
&nbsp;&nbsp;There are about 120 test cases in total, but 90% of them are relatively small. More precisely, all numbers are less than or equal to 100 in 90% of the test cases.<br />
</span></p>
<div class="panel_bottom"><span style="font-size: medium">&nbsp;</span></div>
<p><span style="font-size: medium"><br />
</span>&nbsp;</p></div><h2>Output</h2><div class=content><div class="panel_content"><span style="font-size: medium">&nbsp;&nbsp;For each test case:<br />
&nbsp;&nbsp;For each positive integer, output the number of ways in a single line. To keep the output finite, only numbers with positive ways should be outputted.<br />
&nbsp;&nbsp;Output a blank line after each test case. See sample for more format details.<br />
</span></div>
<div class="panel_content">
<pre></pre>
</div></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>3<br />
3 3<br />
1 2 3<br />
5 4<br />
1 3 5 6 7<br />
10 3<br />
1 2 3 4 5 6 7 8 9 10<br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata>Case #1:<br />
6: 1<br />
<br />
Case #2:<br />
15: 1<br />
16: 1<br />
17: 1<br />
19: 1<br />
21: 1<br />
<br />
Case #3:<br />
6: 1<br />
7: 1<br />
8: 2<br />
9: 3<br />
10: 4<br />
11: 5<br />
12: 7<br />
13: 8<br />
14: 9<br />
15: 10<br />
16: 10<br />
17: 10<br />
18: 10<br />
19: 9<br />
20: 8<br />
21: 7<br />
22: 5<br />
23: 4<br />
24: 3<br />
25: 2<br />
26: 1<br />
27: 1<br />
</span></div><h2>HINT</h2>
			<div class=content><p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search=Acm 2011 上海'>Acm 2011 上海</a></p></div><center>[<a href='submitpage.php?id=2498'>Submit</a>][<a href='problemstatus.php?id=2498'>Status</a>][<a href='bbs.php?id=2498'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
